home *** CD-ROM | disk | FTP | other *** search
- ;*************************************************************************
- ;** mmu.library **
- ;** **
- ;** a system library for arbitration and control of the MC68K MMUs **
- ;** **
- ;** © 1998 THOR-Software, Thomas Richter **
- ;** No commercial use, reassembly, modification without prior, written **
- ;** permission of the authors. **
- ;** Including this library in any commercial software REQUIRES a **
- ;** written permission and the payment of a small fee. **
- ;** **
- ;** This is an internal header file, do not depend on anything here. **
- ;** Use the official include files. **
- ;** Distributed only for the mmu.library development group for private **
- ;** use. **
- ;** **
- ;**---------------------------------------------------------------------**
- ;** Block: Load the MMU library for testing purposes **
- ;*************************************************************************
-
- ;FOLD Includes
- include inc:exec_lib.asm
- include inc:dos_lib.asm
- include inc:macros.asm
- ;ENDFOLD
- ;FOLD Structures
- ;*************************************************
- ;** The main structure for this **
- ;** little something **
- ;*************************************************
- rsreset
- mn_SysBase: rs.l 1
- mn_DosBase: rs.l 1
- mn_MMUBase: rs.l 1
- mn_Segment: rs.l 1
- mn_len: rs.b 0
- ;ENDFOLD
-
- section main_code,code
- ;FOLD Start
- ;*************************************************
- ;** Start **
- ;*************************************************
- Start:
- move.l ExecBase,a6
- moveq #37,d0
- lea MainBss,a5
- move.l a6,mn_SysBase(a5)
- lea DosName,a1
- jsr OpenLibrary(a6)
- move.l d0,mn_DosBase(a5)
- beq.s .exit
-
- move.l d0,a6
- move.l #LibrarySegment,d1
- jsr LoadSeg(a6)
- move.l d0,mn_Segment(a5)
- beq.s .closeexit
-
- move.l d0,a0
- move.l d0,d1
- adda.l a0,a0
- adda.l a0,a0
- move.l -4(a0),d0 ;get size of the segment
- lsr.l #1,d0 ;in words
- subq.l #4,d0 ;size and BPTR doesn't count
- addq.l #4,a0 ;pointer to first code
- do
- cmp.w #$4afc,(a0)+ ;illegal ?
- beq.s .found ;if so, found it
- .retry:
- subq.l #1,d0 ;count down
- while.s ne
- moveq #0,d0 ;exit: resident tag not found
- bra.s .unloadexit
- .found:
- lea -2(a0),a1 ;ptr to ResidentTag
- cmp.l (a0),a1 ;is this a resident tag?
- bne.s .retry
-
- move.l mn_SysBase(a5),a6
- jsr InitResident(a6) ;initialize this thing
- move.l d0,mn_MMUBase(a5) ;must be initialized
- beq.s .unloadexit
-
- move.l d0,a6
- jsr -$12(a6) ;Expunge it
- .unloadexit:
- move.l mn_DOSBase(a5),a6
- move.l mn_Segment(a5),d1
- jsr UnloadSeg(a6)
- .closeexit:
- move.l mn_SysBase(a5),a6
- move.l mn_DOSBase(a5),a1
- jsr CloseLibrary(a6)
- .exit:
- moveq #0,d0
- rts
- ;ENDFOLD
-
- ;FOLD Data
- section main_data,data
-
- DosName: dc.b "dos.library",0
- LibrarySegment: dc.b "mmu.library",0
-
- section main_bss,bss
- MainBSS: ds.b mn_len
-
- ;ENDFOLD
-